#!/usr/bin/env python
import pika

cred = pika.PlainCredentials('cve_work', 'cve_work')
conn = pika.BlockingConnection(pika.ConnectionParameters(host='118.178.239.213', port=21121, credentials=cred))
channel = conn.channel()
channel.exchange_declare(exchange='logs', exchange_type='fanout')
result = channel.queue_declare(queue='', exclusive=True)
queue_name = result.method.queue
channel.queue_bind(exchange='logs', queue=queue_name)


def callback(ch, method, properties, body):
    print(" [x] %r" % body, type(body))


channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True)

channel.start_consuming()
